<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<!--头部导航栏-->
<nav class="navbar navbar-inverse navbar-fixed-top" th:fragment="topbar">
	<div class="container-fluid">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle collapsed"
				data-toggle="collapse" data-target="#navbar" aria-expanded="false"
				aria-controls="navbar">
				<span class="sr-only"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span> <span class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="#"> 欢迎！<span
				sec:authentication="name"></span>
			</a>
			<!-- 2.2.1不支持    最低支持2.0.9 a标签内表示登录后显示 span标签内未显示用户权限信息 -->
			<a sec:authorize="isAuthenticated()" class="navbar-brand"> 权限<span
				sec:authentication="principal.authorities"></span>
			</a> <a class="navbar-brand"> 时间：<span th:text="${date}"></span></a>

		</div>
		<div id="navbar" class="navbar-collapse collapse">
			<ul class="nav navbar-nav navbar-right">
				<li><a th:href="@{/index}">主页</a></li>

				<!--如果未登录，显示登录  -->
				<li sec:authorize="!isAuthenticated()"><a th:href="@{/login}">登录</a></li>

				<!--如果登录，显示注销 -->
				<li sec:authorize="isAuthenticated()"><a th:href="@{/logout}">注销</a></li>

			</ul>
			<form class="navbar-form navbar-right">
				<input type="text" class="form-control" placeholder="搜索">
			</form>
		</div>
	</div>
</nav>

<!--侧边栏-->
<div class="col-sm-3 col-md-2 sidebar" th:fragment="sidebar">
	<ul class="nav nav-sidebar">
		<li th:class="${active == 'main.html' ? 'active' : ''}"><a
			th:href="@{/index}">主页</a></li>
		<li th:class="${active == 'list.html' ? 'active' : ''}"><a
			th:href="@{/emps}">列表</a></li>
		<li th:class="${active == 'main1.html' ? 'active' : ''}"><a
			href="#">使用者</a></li>
		<li th:class="${active == 'main2.html' ? 'active' : ''}"><a
			th:href="@{/user/findAll}">单表分页查询</a></li>
	</ul>
</div>


</html>